#include<stdio.h>
int main(void)
{
    int n,i;
    double score;
    double sum=0.0,max,min;
    scanf("%d",&n);

        for(i=0;i<n;i++){
            scanf("%lf",&score);
            max=score;
            min=score;
            sum += score;
            if(score>max)
                max=score;
                else
                    min=score;


        }
            printf("%.2lf",(sum-max-min)/(n-2));

        return 0;
}